package info.nightbrest.agt.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import info.nightbrest.agt.shared.rpc.action.LoginAction;

public class UserLoggedInEvent extends GwtEvent<UserLoggedInEvent.Handler>
{
	public static Type<UserLoggedInEvent.Handler> TYPE = new Type<UserLoggedInEvent.Handler>();

	private LoginAction.Response loginResponse;

	public UserLoggedInEvent(LoginAction.Response loginResponse) {
		this.loginResponse = loginResponse;
	}

	@Override
	public Type<UserLoggedInEvent.Handler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(UserLoggedInEvent.Handler handler) {
		handler.onUserLoggedIn(loginResponse);
	}

	public interface Handler extends EventHandler
	{
		void onUserLoggedIn(LoginAction.Response r);
	}

}
